package ds.factcom.domain.product;

import java.util.LinkedList;
import java.util.List;

import ds.factcom.domain.Domain;
import ds.factcom.domain.invoice.Invoice;

/**
 * 
 * @author Javier De Luca, Maximiliano Herrera, Matias Samblancat
 * 
 */
public class Product extends Domain {

	/**
	 * 
	 */
	private static final long serialVersionUID = -230172425603598530L;

	private static Integer idLast = 0;
	private String description;
	private Float price;
	
	private List<Invoice> invoices;
	
	public Product(String description, Float price ) {
		idLast = this.generateId();
		this.setId(idLast);
		this.description = description;
		this.price = price;
		this.invoices = new LinkedList<Invoice>();
	}

	@Override
	protected Integer getLastId() {
		return idLast;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Float getPrice() {
		return price;
	}
	public void setPrice(Float price) {
		this.price = price;
	}

	@Override
	public boolean equals(Object obj) {
		Product product = (Product) obj;
		return this.description.equalsIgnoreCase(product.getDescription());
	}

	public List<Invoice> getInvoices() {
		return invoices;
	}

	public void setInvoices(List<Invoice> invoices) {
		this.invoices = invoices;
	}
}
